package com.zzh.bc.model;

import com.zzh.bc.annotations.HColumn;

import java.util.ArrayList;
import java.util.List;

/**
 * 接口表
 */
public class ApiModel {

    public static final String TABLE_NAME = "zh_apis";
    public static final String SQL_COLUMN_NAME = "api_id,api_name,api_pattern,api_project_id,api_req_method,created_by,created_time,updated_by,updated_time";
    public static final String SQL_COLUMN_PARAMS = "?,?,?,?,?,?,?,?,?";
    public static final String SQL_DELETE = "DELETE FROM " + TABLE_NAME + " WHERE api_id=?";
    //接口ID
    @HColumn(columnName = "api_id")
    private String apiId;
    /**
     * 接口名称
     */
    @HColumn(columnName = "api_name")
    private String apiName;
    /**
     * 接口路径
     */
    @HColumn(columnName = "api_pattern")
    private String apiPattern;
    /**
     * 属于哪个项目
     */
    @HColumn(columnName = "api_project_id")
    private String apiProjectId;
    /**
     * 请求方式
     */
    @HColumn(columnName = "api_req_method")
    private String apiReqMethod;
    /**
     * 创建人
     */
    @HColumn(columnName = "created_by")
    private String createdBy;
    /**
     * 创建时间
     */
    @HColumn(columnName = "created_time")
    private long createdTime;
    /**
     * 修改人ID
     */
    @HColumn(columnName = "updated_by")
    private String updatedBy;
    /**
     * 更改时间
     */
    @HColumn(columnName = "updated_time")
    private long updatedTime;

    private List<ApiParamModel> data;

    public List<ApiParamModel> getData() {
        if (data == null) {
            return new ArrayList<>();
        }
        return data;
    }

    public void setData(List<ApiParamModel> data) {
        this.data = data;
    }

    public String getApiId() {
        return apiId == null ? "" : apiId;
    }

    public void setApiId(String apiId) {
        this.apiId = apiId;
    }

    public String getApiName() {
        return apiName == null ? "" : apiName;
    }

    public void setApiName(String apiName) {
        this.apiName = apiName;
    }

    public String getApiPattern() {
        return apiPattern == null ? "" : apiPattern;
    }

    public void setApiPattern(String apiPattern) {
        this.apiPattern = apiPattern;
    }

    public String getApiProjectId() {
        return apiProjectId == null ? "" : apiProjectId;
    }

    public void setApiProjectId(String apiProjectId) {
        this.apiProjectId = apiProjectId;
    }

    public String getApiReqMethod() {
        return apiReqMethod == null ? "" : apiReqMethod;
    }

    public void setApiReqMethod(String apiReqMethod) {
        this.apiReqMethod = apiReqMethod;
    }

    public String getCreatedBy() {
        return createdBy == null ? "" : createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    public long getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(long createdTime) {
        this.createdTime = createdTime;
    }

    public String getUpdatedBy() {
        return updatedBy == null ? "" : updatedBy;
    }

    public void setUpdatedBy(String updatedBy) {
        this.updatedBy = updatedBy;
    }

    public long getUpdatedTime() {
        return updatedTime;
    }

    public void setUpdatedTime(long updatedTime) {
        this.updatedTime = updatedTime;
    }
}
